<?php
header("Content-type:text/html; charset=utf-8;");
require '../../../ppf/fun.php';
require '../../../ppf/pdo_mysql.php';
require '../../../ppf/Filter.php';
date_default_timezone_set("PRC");
$pd=new pdo_mysql();
$filter=new Filter();
session_start();
if(empty($_SESSION['uid'])){
	echo '请登录后再进行操作';exit;
}
$submitMethod=$_SERVER["REQUEST_METHOD"];
if($submitMethod=='POST'){
    $now=date('Y-m-d H:i:s',time());
    $content      = empty($_POST['content'])?"":$_POST['content'];
	$type =  empty($_POST['type'])?1:$_POST['type'];
	$in_data=array(
			'uid'  =>$_SESSION['uid'],
			'content'    =>$content,
			'time'       =>$now,
			'type'  =>$type
	    );
	$rs = $pd->exec("insert into sys_worklogs(uid,content,time,type) values(
										'".$_SESSION['uid']."',
										'".$content."',
										'".$now."',
										'".$type."'
		)");
	//$rs = $pd->insert(array('data'=>$in_data,'table'=>'sys_worklogs'));
	if($rs){
		$tips='新建日志成功';
	}else{
		$tips='新建日志失败，请重试';
	}
	echo $tips;exit;
}else{
	echo '不允许的表单提交方式，请按正常流程提交表单。';exit;
}
?>